<template>
  <a-form-model ref="formRefs" :rules="validatorRules" :model="formData" v-bind="formItemLayout">
    <a-form-model-item label="申请者号" prop="applicantId" v-if="businessType == 45">
      <a-input v-model="formData.applicantId" placeholder="请输入" style="max-width:500px;" />
    </a-form-model-item>
    <a-form-model-item label="病人编号" prop="patientId" v-if="businessType == 45">
      <a-input v-model="formData.patientId" placeholder="请输入" style="max-width:500px;" />
    </a-form-model-item>
    <a-form-model-item label="社戒社康办公室意见" prop="officeComments"
      v-if="businessType == 26 || businessType == 27 || businessType == 28 || businessType == 29">
      <a-textarea :auto-size="{ minRows: 4, maxRows: 6 }" v-model="formData.officeComments" placeholder="请输入" />
      <a-button icon="file-text"> 生成评估报告 </a-button>
      <a-tooltip style="margin-left:10px;" placement="topLeft">
        <template slot="title">
          生成评估报告，供下载后盖章上传使用
        </template>
        <a-icon type="exclamation-circle" />
      </a-tooltip>
      <br />
      <a-space style="padding-left: 8px;">
        <span> 社区戒毒／社区康复人员年度（季度）综合评估表.pdf </span>
        <!-- <a-button type="link" block> 预览 </a-button> -->
        <a :href=evaluationReport target="_blank" style="padding-left: 8px;"> 下载 </a>
        <!-- <a-button type="link" block> 下载 </a-button> -->
      </a-space>
    </a-form-model-item>
    <a-form-model-item label="上传评估报告"
      v-if="businessType == 26 || businessType == 27 || businessType == 28 || businessType == 29">
      <j-upload v-model="formData.evalReportDocument" :isMultiple="true" />
    </a-form-model-item>
    <!-- <template v-if="businessType == 16 && jsonParam.caseType == '1'">
      <a-form-model-item label="所在公安局" prop="policeBureau">
        <a-input v-model="formData.policeBureau" placeholder="请输入" style="max-width:500px;" />
      </a-form-model-item>
      <a-form-model-item label="所在派出所" prop="precinct">
        <a-input v-model="formData.precinct" placeholder="请输入" style="max-width:500px;" />
      </a-form-model-item>
      <a-form-model-item label="通知书编号" prop="number">
        <a-input v-model="formData.number" placeholder="请输入" style="max-width:500px;" />
      </a-form-model-item>
    </template> -->
  </a-form-model>
</template>

<script>
export default {
  props: {
    businessType: {
      type: [String, Number],
      required: true
    },
    jsonParam: {
      type: Object
    }
  },
  data() {
    return {
      evaluationReport: '',
      formData: {},
      formItemLayout: {
        labelCol: { span: 3 },
        wrapperCol: { span: 16 },
      },
      validatorRules: {
        applicantId: [{ required: true, message: '请输入申请者号', trigger: 'change' },],
        patientId: [{ required: true, message: '请输入病人编号', trigger: 'change' },],
        officeComments: [{ required: true, message: '请输入社戒社康办公室意见', trigger: 'change' },],
        evalReportDocument: [{ required: true, message: '请上传上传评估报告', trigger: 'change' },],
        // policeBureau: [{ required: true, message: '请输入申请者号', trigger: 'change' },],
        // precinct: [{ required: true, message: '请输入申请者号', trigger: 'change' },],
        number: [{ required: true, message: '请输入申请者号', trigger: 'change' },],
      }
    }
  },
  watch: {
    jsonParam: {
      immediate: true,
      deep: true,
      handler(result) {
        this.evaluationReport = result.evaluationReport
        const id = result && Object.keys(result).length > 0 && result.id ? result.id : ''
        this.$set(this.formData, 'id', id)
      }
    }
  },
  mounted() { },
  methods: {}
}
</script>
<style lang="less" scoped>
/deep/.ant-form-item {
  margin-bottom: 12px;
}
</style>